package com.coffee.core;

/**
 * 业务层异常
 * @auther: SongKui ON  2018/10/31 14:48
 * @Description:
 */
public class CoffeeException extends RuntimeException {
    private static final long serialVersionUID = 81825460722287938L;
    private String message;
    private ResponseCode state;
    private Integer cmd;

    public CoffeeException(ResponseCode responseCode){
        super(responseCode.message());
        this.state = responseCode;
        this.message = responseCode.message();
    }

    public CoffeeException(ResponseCode responseCode, int cmd){
        super(responseCode.message());
        this.state = responseCode;
        this.message = responseCode.message();
        this.cmd = cmd;
    }


    public CoffeeException(String message) {
        super(message);
        this.message = message;
        this.state = CoffeeResponseEnum.SysException;
    }


    public CoffeeException(final String msgCode, final Throwable ex) {
        super(msgCode, ex);
    }

    public String getMessge() {
        return message;
    }

    public int getCmd(){
        return this.cmd;
    }

    public ResponseCode getState(){
        return state;
    }

}
